<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        let name = "崽崽";
        let gender = "man";
        let age = "18";
        let obj = {
            name,
            skill(){
                console.log("我爱你")
            }
        }
        let obj1 = {
            gender
        }
        let obj2 = {
            age
        }
        // let obj3 = Object.assign(obj,obj1,obj2);
        // console.log(obj);
        // console.log(obj1);
        // console.log(obj2);
        // console.log(obj3);

        // 浅拷贝
        let obj4 = {
            name:"张三",
            age : 18,
            gender:"男",
            hobbies:["吃","喝","玩"]
        }
        let obj5 = Object.assign({},obj4);
        // console.log(obj4);
        // console.log(obj5);

        obj4.name = "李四";
        obj4.hobbies[0] = "乐";


        // console.log(Object.keys(obj4));
        // console.log(Object.values(obj4));
        // console.log(Object.keys(obj5))
        // console.log(Object.values(obj5))


        let obj6 = {
            name:"张三",
            age:18,
            gender:"男",
            skill:["坑","蒙","拐"]
        }
        // let jsonStr = JSON.stringify(obj6);
        // console.log(jsonStr);
        // let obj7 = JSON.parse(jsonStr);
        // console.log(obj7);

        let obj8 = {name:"李四",age:"18",skill:["吃","喝","玩"]};
        let jStr = JSON.stringify(obj8);
        let obj9 = JSON.parse(jStr);
        console.log(obj8);
        console.log(obj9);
        obj8.name = "张三";
        obj8.skill[0] = "抽"
    </script>
</body>
</html>